<?php
/**
 * @author 天涯 <mail@phpha.com>
 * @copyright http://blog.phpha.com
 * @link http://blog.phpha.com/vncms
 * @version 1.0
 */
defined('APP_PATH') or exit('Access Denied');
class check extends spController{
	public function __construct(){
		parent::__construct();
		//授权服务器列表
		$server = array('127.0.0.2');
		if(!in_array($_SERVER['SERVER_ADDR'], $server))	exit('Server - Access Denied');
		//授权域名列表
		$domain = array('127.0.0.2');
		$vonuod = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'].($_SERVER['SERVER_PORT']=='80' ? '' : ':'.$_SERVER['SERVER_PORT']));
		if(!in_array($vonuod, $domain))	exit('Domain - Access Denied');
		//登陆检测
		if(empty($_SESSION['admin'])){
			$this->jump(spUrl('open','login'));
		}
		//权限检测
		if(false == spClass('m_gaacl')->check()){
			$this->error('您没有权限执行此操作！', spUrl('site','info'));
		}
	}
	public function success($msg, $url = ''){
		$this->msg = $msg;
		$this->url = $url;
		$this->display('message.tpl.php');
		exit;
	}
	public function error($msg, $url = ''){
		$this->msg = $msg;
		$this->url = $url;
		$this->display('message.tpl.php');
		exit;
	}
}
